<?php
require_once("vcl/vcl.inc.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class redirect_report extends Page
{
       public $Button1 = null;
       public $Label3 = null;
       public $Label2 = null;
       public $Label1 = null;
       public $hfPrintOrExcel = null;
       public $hfAllOrSelect = null;
       public $hfDateTo = null;
       public $hfDateFrom = null;
       public $hfReportType = null;
       function Button1JSClick($sender, $params)
       {

       ?>
       alert('x'+document.getElementById('hfAllOrSelect').value+'x'+document.getElementById('hfReportType').value+'x'+document.getElementById('hfDateFrom').value+'x'+document.getElementById('hfDateTo').value+'x'+document.getElementById('hfPrintOrExcel').value);
       <?php

       }

       function Label3JSClick($sender, $params)
       {

       ?>
       window.close();
       //window.location.href = "select_report.php";
       //document.location.reload();
       <?php

       }

       function redirect_reportJSLoad($sender, $params)
       {

       ?>
       var redirect = document.getElementById('hfPrintOrExcel').value;
       var date_to = document.getElementById('hfDateTo').value;
       if(redirect=='Print')
       {
        document.getElementById('redirect_report').action = 'print_veh_reports.php';
        document.redirect_report.submit();
       }
       if(redirect=='Excel')
       {
        document.getElementById('redirect_report').action = 'excel_veh_reports.php';
        document.redirect_report.submit();
        //setTimeout('window.close()',2500);
       }
       //document.redirect_report.submit();

       <?php

       }

       function redirect_reportCreate($sender, $params)
       {
       $all_or_select = $_POST['hfAllOrSelect'];
       $report_type = $_POST['cmbReportType'];
       $date_from = $_POST['hfDateFrom'];
       $date_to = $_POST['hfDateTo'];
       $print_or_excel  = $_POST['hfPrintOrExcel'];

       $this->hfAllOrSelect->setValue($all_or_select);
       $this->hfReportType->setValue($report_type);
       $this->hfDateFrom->setValue($date_from);
       $this->hfDateTo->setValue($date_to);
       $this->hfPrintOrExcel->setValue($print_or_excel);
       }


}

global $application;

global $redirect_report;

//Creates the form
$redirect_report=new redirect_report($application);

//Read from resource file
$redirect_report->loadResource(__FILE__);

//Shows the form
$redirect_report->show();

?>